#ifndef NANE_SCRIPTSYSTEM_H
#   define  NANE_SCRIPTSYSTEM_H

#   include "nane/ScriptSystem/IScriptSystem.h"
#   include "nane/core/SubSystem.h"
#   include "nane/core/function/Functor.h"
#   include "nane/core/crt/FileSystem.h"

#   include "nane/ScriptSystem/ScriptModule.h"

namespace nane
{
    
    class ScriptSystem
        : public SubSystem<IScriptSystem>
    {
    public:
        ScriptSystem();
        ~ScriptSystem();
        
        bool Initialize();
        
    public:
        ScriptModule LoadModule( const char* _moduleName, const InputPtr& _input );
        template<typename F>
        void ExportGlobalFunction( const char* _className, const char* _functionName, F _functor )
        {
            ExportGlobalFunction_(_className, _functionName, new ScriptFunctionAdapter<F>(_functor));
        }
        
    private:
        void ExportGlobalFunction_( const char* _className, const char* _functionName, ScriptFunctionBase* _scriptFunction );

    public:
        class Implementation;
        Implementation* m;
    };

}   // namespace nane

#endif	// NANE_SCRIPTSYSTEM_H
